package spec.caoyujuan.unit3_3;

public class FinanceInfo2 {
    private  String companyName;
    private double earnestIncome;
    private double depositIncome;
    private double rentIncome;
    private double otherIncome;
    private double staffCost;
    private double rentCont;
    private double hydropowerCost;
    private double taxCost;
    private double otherCost;

    //无参数构造方法
public FinanceInfo2(){
    System.out.println("使用无参数构造方法创建财务信息对象！");
}
//带参数构造
public FinanceInfo2(String companyName,double earnestIncome,double staffCost,double rentCost,double hydropowerCost,double taxCost,double otherCost) {
    super();
    System.out.println("使用带参数的构造方法创建财务信息对象");
    this.companyName = companyName;
    this.earnestIncome = earnestIncome;
    this.depositIncome = depositIncome;
    this.rentIncome = rentIncome;
    this.otherIncome = otherIncome;
    this.staffCost = staffCost;
    this.rentCont = rentCost;
    this.hydropowerCost = hydropowerCost;
    this.taxCost = taxCost;
    this.otherCost = otherCost;}
    public double calIncome(){
    double sumIncome=earnestIncome+depositIncome+rentIncome+otherIncome;
    return sumIncome;}
    public double calCost(){
        double sumCost=staffCost+rentCont+hydropowerCost+taxCost+otherCost;
        return sumCost;
    }
    public double calNetIncome(){
        System.out.println(companyName+"的净收入计算结果：");
        double netIncome=calIncome()-calCost();
        return netIncome;
    }
}


